package com.cpecc.mail;

import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Properties;
import javax.mail.Authenticator;
import javax.mail.BodyPart;
import javax.mail.Message;
import javax.mail.Multipart;
import javax.mail.PasswordAuthentication;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart;
import com.cpecc.model.system.Email;
import com.cpecc.model.system.User;
import com.cpecc.model.system.YouJian;
import com.cpecc.model.wuzi.BaoFei;
import com.cpecc.model.wuzi.BaoFeiJL;
import com.cpecc.model.wuzi.BaoFeiSPR;
import com.cpecc.model.wuzi.BuPei;
import com.cpecc.model.wuzi.CaiGouSPR;
import com.cpecc.model.wuzi.HuanHuo;
import com.cpecc.model.wuzi.ShenQing;
import com.cpecc.model.wuzi.TuiHuo;
import com.cpecc.model.wuzi.WeiXiu;
import com.cpecc.model.wuzi.WuZi;
import com.cpecc.model.wuzi.YiJiao;

public class SendMailThread implements Runnable{
		
	private Email email;
	
	private String root;
	
	private int huanJie;
	
	private User user;
	
	private YouJian youJian;
	
	private ShenQing shenQing;
	
	private CaiGouSPR caiGouSPR;
	
	private WuZi wuZi;
	
	private WeiXiu weiXiu;
	
	private BaoFei baoFei;
	
	private BaoFeiSPR baoFeiSPR;
	
	private BaoFeiJL baoFeiJL;
	
	private YiJiao yiJiao;
	
	private BuPei buPei;
	
	private TuiHuo tuiHuo;
	
	private HuanHuo huanHuo;

	public SendMailThread(Email email, String root, int huanJie, User user,
			YouJian youJian) {
		super();
		this.email = email;
		this.root = root;
		this.huanJie = huanJie;
		this.user = user;
		this.youJian = youJian;
	}

	public ShenQing getShenQing() {
		return shenQing;
	}

	public void setShenQing(ShenQing shenQing) {
		this.shenQing = shenQing;
	}
	
	public CaiGouSPR getCaiGouSPR() {
		return caiGouSPR;
	}

	public void setCaiGouSPR(CaiGouSPR caiGouSPR) {
		this.caiGouSPR = caiGouSPR;
	}

	public WuZi getWuZi() {
		return wuZi;
	}

	public void setWuZi(WuZi wuZi) {
		this.wuZi = wuZi;
	}

	public WeiXiu getWeiXiu() {
		return weiXiu;
	}

	public void setWeiXiu(WeiXiu weiXiu) {
		this.weiXiu = weiXiu;
	}

	public BaoFei getBaoFei() {
		return baoFei;
	}

	public void setBaoFei(BaoFei baoFei) {
		this.baoFei = baoFei;
	}

	public BaoFeiSPR getBaoFeiSPR() {
		return baoFeiSPR;
	}

	public void setBaoFeiSPR(BaoFeiSPR baoFeiSPR) {
		this.baoFeiSPR = baoFeiSPR;
	}

	public BaoFeiJL getBaoFeiJL() {
		return baoFeiJL;
	}

	public void setBaoFeiJL(BaoFeiJL baoFeiJL) {
		this.baoFeiJL = baoFeiJL;
	}

	public YiJiao getYiJiao() {
		return yiJiao;
	}

	public void setYiJiao(YiJiao yiJiao) {
		this.yiJiao = yiJiao;
	}

	public BuPei getBuPei() {
		return buPei;
	}

	public void setBuPei(BuPei buPei) {
		this.buPei = buPei;
	}

	public TuiHuo getTuiHuo() {
		return tuiHuo;
	}

	public void setTuiHuo(TuiHuo tuiHuo) {
		this.tuiHuo = tuiHuo;
	}

	public HuanHuo getHuanHuo() {
		return huanHuo;
	}

	public void setHuanHuo(HuanHuo huanHuo) {
		this.huanHuo = huanHuo;
	}

	@Override
	public void run() {
		try {
			String content=youJian.getContent();
			if(huanJie==0){
				content=content.replace("{username}",user.getUserName());
				content=content.replace("{password}",user.getPassword());
			}else if(huanJie>100 && huanJie<200){
				if(huanJie==102){
					ShenQing shenQing=caiGouSPR.getShenQing();
					String format="yyyy-MM-dd";
					SimpleDateFormat sdf=new SimpleDateFormat(format);
					String shenQingRQ=sdf.format(shenQing.getShenQingRQ());
					content=content.replace("{申请日期}", shenQingRQ);
					String userName=shenQing.getUser().getName();
					content=content.replace("{申请人}", userName);
					String depName=shenQing.getUser().getDep().getDepName();
					content=content.replace("{申请部门}", depName);
					String miaoShu=shenQing.getWuZiMiaoShu();
					content=content.replace("{申请物资描述}", miaoShu);
					String yuanYin=shenQing.getShenQingYY();
					content=content.replace("{申请原因}", yuanYin);
					content=content.replaceAll(" ", "&nbsp;");
					content=content.replaceAll("\n", "<br>");
					String access_url="<a href=\""+root+"/youjian/access.do?userId="+user.getId()+"&huanJie="+huanJie+"\">进入</a>";
					content=content.replace("{access_url}", access_url);
					String agree_url="<a href=\""+root+"/youjian/agree.do?id="+caiGouSPR.getId()+"&userId="+user.getId()+"&huanJie="+huanJie+"\">同意</a>";
					content=content.replace("{agree_url}", agree_url);
					String disagree_url="<a href=\""+root+"/youjian/disagree.do?id="+caiGouSPR.getId()+"&userId="+user.getId()+"&huanJie="+huanJie+"\">不同意</a>";
					content=content.replace("{disagree_url}", disagree_url);
				}else if(huanJie==103){
					String format="yyyy-MM-dd";
					SimpleDateFormat sdf=new SimpleDateFormat(format);
					String shenQingRQ=sdf.format(shenQing.getShenQingRQ());
					content=content.replace("{申请日期}", shenQingRQ);
					String userName=shenQing.getUser().getName();
					content=content.replace("{申请人}", userName);
					String depName=shenQing.getUser().getDep().getDepName();
					content=content.replace("{申请部门}", depName);
					String miaoShu=shenQing.getWuZiMiaoShu();
					content=content.replace("{申请物资描述}", miaoShu);
					String yuanYin=shenQing.getShenQingYY();
					content=content.replace("{申请原因}", yuanYin);
					content=content.replaceAll(" ", "&nbsp;");
					content=content.replaceAll("\n", "<br>");
					String access_url="<a href=\""+root+"/youjian/access.do?userId="+user.getId()+"&huanJie="+huanJie+"\">进入</a>";
					content=content.replace("{access_url}", access_url);
				}else if(huanJie==104){
					String format="yyyy-MM-dd";
					SimpleDateFormat sdf=new SimpleDateFormat(format);
					String shenQingRQ=sdf.format(shenQing.getShenQingRQ());
					content=content.replace("{申请日期}", shenQingRQ);
					String userName=shenQing.getUser().getName();
					content=content.replace("{申请人}", userName);
					String depName=shenQing.getUser().getDep().getDepName();
					content=content.replace("{申请部门}", depName);
					String miaoShu=shenQing.getWuZiMiaoShu();
					content=content.replace("{申请物资描述}", miaoShu);
					String yuanYin=shenQing.getShenQingYY();
					content=content.replace("{申请原因}", yuanYin);
					content=content.replaceAll(" ", "&nbsp;");
					content=content.replaceAll("\n", "<br>");
					String access_url="<a href=\""+root+"/youjian/access.do?userId="+user.getId()+"&huanJie="+huanJie+"\">进入</a>";
					content=content.replace("{access_url}", access_url);
				}else if(huanJie==105){
					String format="yyyy-MM-dd";
					SimpleDateFormat sdf=new SimpleDateFormat(format);
					String gouMaiRQ=sdf.format(wuZi.getGouMaiRQ());
					content=content.replace("{购买日期}", gouMaiRQ);
					content=content.replace("{采买人}", shenQing.getCaiMaiR().getName());
					content=content.replace("{物资名称}", wuZi.getWuZiMC());
					content=content.replace("{品牌}", wuZi.getPinPai());
					content=content.replace("{规格型号}", wuZi.getGuiGeXH());
					content=content.replaceAll(" ", "&nbsp;");
					content=content.replaceAll("\n", "<br>");
					String access_url="<a href=\""+root+"/youjian/access.do?userId="+user.getId()+"&huanJie="+huanJie+"\">进入</a>";
					content=content.replace("{access_url}", access_url);
				}else if(huanJie==106){
					String format="yyyy-MM-dd";
					SimpleDateFormat sdf=new SimpleDateFormat(format);
					String gouMaiRQ=sdf.format(wuZi.getGouMaiRQ());
					content=content.replace("{购买日期}", gouMaiRQ);
					content=content.replace("{资产编号}", wuZi.getZiChanBH());
					content=content.replace("{物资名称}", wuZi.getWuZiMC());
					content=content.replace("{品牌}", wuZi.getPinPai());
					content=content.replace("{规格型号}", wuZi.getGuiGeXH());
					content=content.replaceAll(" ", "&nbsp;");
					content=content.replaceAll("\n", "<br>");
					String access_url="<a href=\""+root+"/youjian/access.do?userId="+user.getId()+"&huanJie="+huanJie+"\">进入</a>";
					content=content.replace("{access_url}", access_url);
				}else if(huanJie==107){
					String format="yyyy-MM-dd";
					SimpleDateFormat sdf=new SimpleDateFormat(format);
					String gouMaiRQ=sdf.format(wuZi.getGouMaiRQ());
					content=content.replace("{购买日期}", gouMaiRQ);
					content=content.replace("{资产编号}", wuZi.getZiChanBH());
					content=content.replace("{物资名称}", wuZi.getWuZiMC());
					content=content.replace("{品牌}", wuZi.getPinPai());
					content=content.replace("{规格型号}", wuZi.getGuiGeXH());
					content=content.replaceAll(" ", "&nbsp;");
					content=content.replaceAll("\n", "<br>");
					String access_url="<a href=\""+root+"/youjian/access.do?userId="+user.getId()+"&huanJie="+huanJie+"\">进入</a>";
					content=content.replace("{access_url}", access_url);
					String agree_url="<a href=\""+root+"/youjian/agree.do?id="+shenQing.getId()+"&userId="+user.getId()+"&huanJie="+huanJie+"\">同意</a>";
					content=content.replace("{agree_url}", agree_url);
				}else if(huanJie==108){
					String format="yyyy-MM-dd";
					SimpleDateFormat sdf=new SimpleDateFormat(format);
					String gouMaiRQ=sdf.format(wuZi.getGouMaiRQ());
					content=content.replace("{购买日期}", gouMaiRQ);
					content=content.replace("{资产编号}", wuZi.getZiChanBH());
					content=content.replace("{物资名称}", wuZi.getWuZiMC());
					content=content.replace("{品牌}", wuZi.getPinPai());
					content=content.replace("{规格型号}", wuZi.getGuiGeXH());
					content=content.replace("{使用部门}", wuZi.getDep().getDepName());
					content=content.replace("{使用人}", wuZi.getUser().getName());
					content=content.replaceAll(" ", "&nbsp;");
					content=content.replaceAll("\n", "<br>");
					String access_url="<a href=\""+root+"/youjian/access.do?userId="+user.getId()+"&huanJie="+huanJie+"\">进入</a>";
					content=content.replace("{access_url}", access_url);
				}else if(huanJie==109){
					String format="yyyy-MM-dd";
					SimpleDateFormat sdf=new SimpleDateFormat(format);
					String gouMaiRQ=sdf.format(wuZi.getGouMaiRQ());
					content=content.replace("{购买日期}", gouMaiRQ);
					content=content.replace("{资产编号}", wuZi.getZiChanBH());
					content=content.replace("{物资名称}", wuZi.getWuZiMC());
					content=content.replace("{品牌}", wuZi.getPinPai());
					content=content.replace("{规格型号}", wuZi.getGuiGeXH());
					content=content.replace("{使用部门}", wuZi.getDep().getDepName());
					content=content.replace("{使用人}", wuZi.getUser().getName());
					content=content.replaceAll(" ", "&nbsp;");
					content=content.replaceAll("\n", "<br>");
					String access_url="<a href=\""+root+"/youjian/access.do?userId="+user.getId()+"&huanJie="+huanJie+"\">进入</a>";
					content=content.replace("{access_url}", access_url);
				}
			}else if(huanJie>200 && huanJie<300){
				if(huanJie==202){
					content=content.replace("{资产编号}", wuZi.getZiChanBH());
					content=content.replace("{物资名称}", wuZi.getWuZiMC());
					content=content.replace("{品牌}", wuZi.getPinPai());
					content=content.replace("{规格型号}", wuZi.getGuiGeXH());
					content=content.replace("{申请部门}", huanHuo.getUser().getDep().getDepName());
					content=content.replace("{申请人}", huanHuo.getUser().getName());
					content=content.replace("{换货原因}", huanHuo.getHuanHuoYY());
					content=content.replaceAll(" ", "&nbsp;");
					content=content.replaceAll("\n", "<br>");
					int lx=1;
					if(huanHuo.getShenQing()!=null)
						lx=1;
					else if(huanHuo.getWeiXiu()!=null)
						lx=2;
					String access_url="<a href=\""+root+"/youjian/access.do?userId="+user.getId()+"&huanJie="+huanJie+"&lx="+lx+"\">进入</a>";
					content=content.replace("{access_url}", access_url);
					String agree_url="<a href=\""+root+"/youjian/agree.do?id="+huanHuo.getId()+"&userId="+user.getId()+"&huanJie="+huanJie+"\">同意</a>";
					content=content.replace("{agree_url}", agree_url);
					String disagree_url="<a href=\""+root+"/youjian/disagree.do?id="+huanHuo.getId()+"&userId="+user.getId()+"&huanJie="+huanJie+"\">不同意</a>";
					content=content.replace("{disagree_url}", disagree_url);
				}else if(huanJie==203){
					content=content.replace("{资产编号}", wuZi.getZiChanBH());
					content=content.replace("{物资名称}", wuZi.getWuZiMC());
					content=content.replace("{品牌}", wuZi.getPinPai());
					content=content.replace("{规格型号}", wuZi.getGuiGeXH());
					content=content.replace("{申请部门}", huanHuo.getUser().getDep().getDepName());
					content=content.replace("{申请人}", huanHuo.getUser().getName());
					content=content.replace("{申请原因}", huanHuo.getHuanHuoYY());
					content=content.replaceAll(" ", "&nbsp;");
					content=content.replaceAll("\n", "<br>");
					String access_url="<a href=\""+root+"/youjian/access.do?userId="+user.getId()+"&huanJie="+huanJie+"\">进入</a>";
					content=content.replace("{access_url}", access_url);
				}
			}else if(huanJie>300 && huanJie<400){
				if(huanJie==302){
					content=content.replace("{资产编号}", wuZi.getZiChanBH());
					content=content.replace("{物资名称}", wuZi.getWuZiMC());
					content=content.replace("{品牌}", wuZi.getPinPai());
					content=content.replace("{规格型号}", wuZi.getGuiGeXH());
					content=content.replace("{申请部门}", tuiHuo.getUser().getDep().getDepName());
					content=content.replace("{申请人}", tuiHuo.getUser().getName());
					content=content.replace("{申请原因}", tuiHuo.getTuiHuoYY());
					content=content.replaceAll(" ", "&nbsp;");
					content=content.replaceAll("\n", "<br>");
					String access_url="<a href=\""+root+"/youjian/access.do?userId="+user.getId()+"&huanJie="+huanJie+"\">进入</a>";
					content=content.replace("{access_url}", access_url);
					String agree_url="<a href=\""+root+"/youjian/agree.do?id="+tuiHuo.getId()+"&userId="+user.getId()+"&huanJie="+huanJie+"\">同意</a>";
					content=content.replace("{agree_url}", agree_url);
					String disagree_url="<a href=\""+root+"/youjian/disagree.do?id="+tuiHuo.getId()+"&userId="+user.getId()+"&huanJie="+huanJie+"\">不同意</a>";
					content=content.replace("{disagree_url}", disagree_url);
				}if(huanJie==303){
					content=content.replace("{资产编号}", wuZi.getZiChanBH());
					content=content.replace("{物资名称}", wuZi.getWuZiMC());
					content=content.replace("{品牌}", wuZi.getPinPai());
					content=content.replace("{规格型号}", wuZi.getGuiGeXH());
					content=content.replace("{申请部门}", tuiHuo.getUser().getDep().getDepName());
					content=content.replace("{申请人}", tuiHuo.getUser().getName());
					content=content.replace("{申请原因}", tuiHuo.getTuiHuoYY());
					content=content.replaceAll(" ", "&nbsp;");
					content=content.replaceAll("\n", "<br>");
					String access_url="<a href=\""+root+"/youjian/access.do?userId="+user.getId()+"&huanJie="+huanJie+"\">进入</a>";
					content=content.replace("{access_url}", access_url);
					String agree_url="<a href=\""+root+"/youjian/agree.do?id="+tuiHuo.getId()+"&userId="+user.getId()+"&huanJie="+huanJie+"\">同意</a>";
					content=content.replace("{agree_url}", agree_url);
				}
			}else if(huanJie>400 && huanJie<500){
				if(huanJie==402){
					String format="yyyy-MM-dd";
					SimpleDateFormat sdf=new SimpleDateFormat(format);
					String shenQingRQ=sdf.format(weiXiu.getShenQingRQ());
					content=content.replace("{申请日期}", shenQingRQ);
					content=content.replace("{申请原因}", weiXiu.getWeiXiuYY());
					content=content.replace("{使用部门}", wuZi.getDep().getDepName());
					content=content.replace("{使用人}", wuZi.getUser().getName());
					content=content.replace("{资产编号}", wuZi.getZiChanBH());
					content=content.replace("{物资名称}", wuZi.getWuZiMC());
					content=content.replace("{品牌}", wuZi.getPinPai());
					content=content.replace("{规格型号}", wuZi.getGuiGeXH());
					content=content.replaceAll(" ", "&nbsp;");
					content=content.replaceAll("\n", "<br>");
					String access_url="<a href=\""+root+"/youjian/access.do?userId="+user.getId()+"&huanJie="+huanJie+"\">进入</a>";
					content=content.replace("{access_url}", access_url);
				}else if(huanJie==403){
					String format="yyyy-MM-dd";
					SimpleDateFormat sdf=new SimpleDateFormat(format);
					String shenQingRQ=sdf.format(weiXiu.getShenQingRQ());
					content=content.replace("{申请日期}", shenQingRQ);
					content=content.replace("{申请原因}", weiXiu.getWeiXiuYY());
					content=content.replace("{使用部门}", wuZi.getDep().getDepName());
					content=content.replace("{使用人}", wuZi.getUser().getName());
					content=content.replace("{资产编号}", wuZi.getZiChanBH());
					content=content.replace("{物资名称}", wuZi.getWuZiMC());
					content=content.replace("{品牌}", wuZi.getPinPai());
					content=content.replace("{规格型号}", wuZi.getGuiGeXH());
					content=content.replaceAll(" ", "&nbsp;");
					content=content.replaceAll("\n", "<br>");
					String access_url="<a href=\""+root+"/youjian/access.do?userId="+user.getId()+"&huanJie="+huanJie+"\">进入</a>";
					content=content.replace("{access_url}", access_url);
				}else if(huanJie==404){
					String format="yyyy-MM-dd";
					SimpleDateFormat sdf=new SimpleDateFormat(format);
					String shenQingRQ=sdf.format(weiXiu.getShenQingRQ());
					content=content.replace("{申请日期}", shenQingRQ);
					content=content.replace("{申请原因}", weiXiu.getWeiXiuYY());
					content=content.replace("{资产编号}", wuZi.getZiChanBH());
					content=content.replace("{物资名称}", wuZi.getWuZiMC());
					content=content.replace("{品牌}", wuZi.getPinPai());
					content=content.replace("{规格型号}", wuZi.getGuiGeXH());
					content=content.replaceAll(" ", "&nbsp;");
					content=content.replaceAll("\n", "<br>");
					String access_url="<a href=\""+root+"/youjian/access.do?userId="+user.getId()+"&huanJie="+huanJie+"\">进入</a>";
					content=content.replace("{access_url}", access_url);
					String agree_url="<a href=\""+root+"/youjian/agree.do?id="+weiXiu.getId()+"&userId="+user.getId()+"&huanJie="+huanJie+"\">同意</a>";
					content=content.replace("{agree_url}", agree_url);
					String disagree_url="<a href=\""+root+"/youjian/disagree.do?id="+weiXiu.getId()+"&userId="+user.getId()+"&huanJie="+huanJie+"\">不同意</a>";
					content=content.replace("{disagree_url}", disagree_url);
				}else if(huanJie==405){
					String format="yyyy-MM-dd";
					SimpleDateFormat sdf=new SimpleDateFormat(format);
					String shenQingRQ=sdf.format(weiXiu.getShenQingRQ());
					content=content.replace("{申请日期}", shenQingRQ);
					content=content.replace("{申请原因}", weiXiu.getWeiXiuYY());
					content=content.replace("{资产编号}", wuZi.getZiChanBH());
					content=content.replace("{物资名称}", wuZi.getWuZiMC());
					content=content.replace("{品牌}", wuZi.getPinPai());
					content=content.replace("{规格型号}", wuZi.getGuiGeXH());
					content=content.replace("{维修负责人}", weiXiu.getWeiXiuR().getName());
					content=content.replace("{维修商}", weiXiu.getWeiXiuShang());
					content=content.replace("{维修说明}", weiXiu.getWeiXiuSM());
					DecimalFormat df=new DecimalFormat("#.00");
					content=content.replace("{维修费用}", df.format(weiXiu.getFeiYong()));
					content=content.replaceAll(" ", "&nbsp;");
					content=content.replaceAll("\n", "<br>");
					String access_url="<a href=\""+root+"/youjian/access.do?userId="+user.getId()+"&huanJie="+huanJie+"\">进入</a>";
					content=content.replace("{access_url}", access_url);
					String agree_url="<a href=\""+root+"/youjian/agree.do?id="+weiXiu.getId()+"&userId="+user.getId()+"&huanJie="+huanJie+"\">同意</a>";
					content=content.replace("{agree_url}", agree_url);
				}
			}else if(huanJie>500 && huanJie<600){
				if(huanJie==502){
					String format="yyyy-MM-dd";
					SimpleDateFormat sdf=new SimpleDateFormat(format);
					content=content.replace("{申请日期}",sdf.format(yiJiao.getShenQingRQ()));
					content=content.replace("{申请部门}", yiJiao.getYiJiaoR().getDep().getDepName());
					content=content.replace("{申请人}", yiJiao.getYiJiaoR().getName());
					content=content.replace("{接收部门}", yiJiao.getJieShouDW().getDepName());
					content=content.replace("{接收人}", yiJiao.getJieShouR().getName());
					content=content.replace("{资产编号}",wuZi.getZiChanBH());
					content=content.replace("{物资名称}",wuZi.getWuZiMC());
					content=content.replace("{品牌}", wuZi.getPinPai());
					content=content.replace("{规格型号}", wuZi.getGuiGeXH());
					content=content.replaceAll(" ", "&nbsp;");
					content=content.replaceAll("\n", "<br>");
					String access_url="<a href=\""+root+"/youjian/access.do?userId="+user.getId()+"&huanJie="+huanJie+"\">进入</a>";
					content=content.replace("{access_url}", access_url);
					String agree_url="<a href=\""+root+"/youjian/agree.do?id="+yiJiao.getId()+"&userId="+user.getId()+"&huanJie="+huanJie+"\">同意</a>";
					content=content.replace("{agree_url}", agree_url);
					String disagree_url="<a href=\""+root+"/youjian/disagree.do?id="+yiJiao.getId()+"&userId="+user.getId()+"&huanJie="+huanJie+"\">不同意</a>";
					content=content.replace("{disagree_url}", disagree_url);
				}else if(huanJie==503){
					String format="yyyy-MM-dd";
					SimpleDateFormat sdf=new SimpleDateFormat(format);
					content=content.replace("{申请日期}",sdf.format(yiJiao.getShenQingRQ()));
					content=content.replace("{申请部门}", yiJiao.getYiJiaoR().getDep().getDepName());
					content=content.replace("{申请人}", yiJiao.getYiJiaoR().getName());
					content=content.replace("{接收部门}", yiJiao.getJieShouDW().getDepName());
					content=content.replace("{接收人}", yiJiao.getJieShouR().getName());
					content=content.replace("{资产编号}",wuZi.getZiChanBH());
					content=content.replace("{物资名称}",wuZi.getWuZiMC());
					content=content.replace("{品牌}", wuZi.getPinPai());
					content=content.replace("{规格型号}", wuZi.getGuiGeXH());
					content=content.replaceAll(" ", "&nbsp;");
					content=content.replaceAll("\n", "<br>");
					String access_url="<a href=\""+root+"/youjian/access.do?userId="+user.getId()+"&huanJie="+huanJie+"\">进入</a>";
					content=content.replace("{access_url}", access_url);
				}else if(huanJie==504){
					String format="yyyy-MM-dd";
					SimpleDateFormat sdf=new SimpleDateFormat(format);
					content=content.replace("{申请日期}",sdf.format(yiJiao.getShenQingRQ()));
					content=content.replace("{申请部门}", yiJiao.getYiJiaoR().getDep().getDepName());
					content=content.replace("{申请人}", yiJiao.getYiJiaoR().getName());
					content=content.replace("{接收部门}", yiJiao.getJieShouDW().getDepName());
					content=content.replace("{接收人}", yiJiao.getJieShouR().getName());
					content=content.replace("{资产编号}",wuZi.getZiChanBH());
					content=content.replace("{物资名称}",wuZi.getWuZiMC());
					content=content.replace("{品牌}", wuZi.getPinPai());
					content=content.replace("{规格型号}", wuZi.getGuiGeXH());
					content=content.replaceAll(" ", "&nbsp;");
					content=content.replaceAll("\n", "<br>");
					String access_url="<a href=\""+root+"/youjian/access.do?userId="+user.getId()+"&huanJie="+huanJie+"\">进入</a>";
					content=content.replace("{access_url}", access_url);
					String agree_url="<a href=\""+root+"/youjian/agree.do?id="+yiJiao.getId()+"&userId="+user.getId()+"&huanJie="+huanJie+"\">同意</a>";
					content=content.replace("{agree_url}", agree_url);
					String disagree_url="<a href=\""+root+"/youjian/disagree.do?id="+yiJiao.getId()+"&userId="+user.getId()+"&huanJie="+huanJie+"\">不同意</a>";
					content=content.replace("{disagree_url}", disagree_url);
				}else if(huanJie==505){
					String format="yyyy-MM-dd";
					SimpleDateFormat sdf=new SimpleDateFormat(format);
					content=content.replace("{申请日期}",sdf.format(yiJiao.getShenQingRQ()));
					content=content.replace("{申请部门}", yiJiao.getYiJiaoR().getDep().getDepName());
					content=content.replace("{申请人}", yiJiao.getYiJiaoR().getName());
					content=content.replace("{使用部门}", wuZi.getDep().getDepName());
					content=content.replace("{使用人}", wuZi.getUser().getName());
					content=content.replace("{资产编号}",wuZi.getZiChanBH());
					content=content.replace("{物资名称}",wuZi.getWuZiMC());
					content=content.replace("{品牌}", wuZi.getPinPai());
					content=content.replace("{规格型号}", wuZi.getGuiGeXH());
					content=content.replaceAll(" ", "&nbsp;");
					content=content.replaceAll("\n", "<br>");
					String access_url="<a href=\""+root+"/youjian/access.do?userId="+user.getId()+"&huanJie="+huanJie+"\">进入</a>";
					content=content.replace("{access_url}", access_url);
					String agree_url="<a href=\""+root+"/youjian/agree.do?id="+yiJiao.getId()+"&userId="+user.getId()+"&huanJie="+huanJie+"\">同意</a>";
					content=content.replace("{agree_url}", agree_url);
				}
			}else if(huanJie>600 && huanJie<700){
				if(huanJie==602){
					content=content.replace("{资产编号}",wuZi.getZiChanBH());
					content=content.replace("{物资名称}",wuZi.getWuZiMC());
					content=content.replace("{品牌}", wuZi.getPinPai());
					content=content.replace("{规格型号}", wuZi.getGuiGeXH());
					content=content.replace("{移交部门}", yiJiao.getYiJiaoR().getDep().getDepName());
					content=content.replace("{移交人}", yiJiao.getYiJiaoR().getName());
					DecimalFormat df=new DecimalFormat("#.00");
					content=content.replace("{物资原值}", df.format(wuZi.getWuZiYZ()));
					content=content.replace("{物资净值}", df.format(wuZi.getWuZiJingZhi()));
					String format="yyyy-MM-dd";
					SimpleDateFormat sdf=new SimpleDateFormat(format);
					String gouMaiRQ="";
					if(wuZi.getGouMaiRQ()!=null)
						gouMaiRQ=sdf.format(wuZi.getGouMaiRQ());
					content=content.replace("{购买日期}", gouMaiRQ);
					content=content.replace("{折旧月限}", "");
					content=content.replace("{报废月限}", "");
					content=content.replaceAll(" ", "&nbsp;");
					content=content.replaceAll("\n", "<br>");
					String access_url="<a href=\""+root+"/youjian/access.do?userId="+user.getId()+"&huanJie="+huanJie+"\">进入</a>";
					content=content.replace("{access_url}", access_url);
					String agree_url="<a href=\""+root+"/youjian/agree.do?id="+yiJiao.getId()+"&userId="+user.getId()+"&huanJie="+huanJie+"\">同意</a>";
					content=content.replace("{agree_url}", agree_url);
					String disagree_url="<a href=\""+root+"/youjian/disagree.do?id="+yiJiao.getId()+"&userId="+user.getId()+"&huanJie="+huanJie+"\">不同意</a>";
					content=content.replace("{disagree_url}", disagree_url);
				}
			}else if(huanJie>700 && huanJie<800){
				if(huanJie==702){
					String format="yyyy-MM-dd";
					SimpleDateFormat sdf=new SimpleDateFormat(format);
					String shenQingRQ=sdf.format(baoFei.getShenQingRQ());
					String gouMaiRQ="";
					if(wuZi.getGouMaiRQ()!=null)
						gouMaiRQ=sdf.format(wuZi.getGouMaiRQ());
					content=content.replace("{申请日期}", shenQingRQ);
					content=content.replace("{申请人}", baoFei.getUser().getName());
					content=content.replace("{物资名称}",wuZi.getWuZiMC());
					content=content.replace("{品牌}",wuZi.getPinPai());
					content=content.replace("{规格型号}", wuZi.getGuiGeXH());
					content=content.replace("{报废原因}",baoFei.getBaoFeiYY());
					content=content.replace("{购买日期}", gouMaiRQ);
					content=content.replace("{折旧月限}", "");
					content=content.replace("{报废月限}", "");
					content=content.replaceAll(" ", "&nbsp;");
					content=content.replaceAll("\n", "<br>");
					String access_url="<a href=\""+root+"/youjian/access.do?userId="+user.getId()+"&huanJie="+huanJie+"\">进入</a>";
					content=content.replace("{access_url}", access_url);
					String agree_url="<a href=\""+root+"/youjian/agree.do?id="+baoFeiSPR.getId()+"&userId="+user.getId()+"&huanJie="+huanJie+"\">同意</a>";
					content=content.replace("{agree_url}", agree_url);
					String disagree_url="<a href=\""+root+"/youjian/disagree.do?id="+baoFeiSPR.getId()+"&userId="+user.getId()+"&huanJie="+huanJie+"\">不同意</a>";
					content=content.replace("{disagree_url}", disagree_url);
				}else if(huanJie==703){
					String format="yyyy-MM-dd";
					SimpleDateFormat sdf=new SimpleDateFormat(format);
					String shenQingRQ=sdf.format(baoFei.getShenQingRQ());
					String gouMaiRQ="";
					if(wuZi.getGouMaiRQ()!=null)
						gouMaiRQ=sdf.format(wuZi.getGouMaiRQ());
					content=content.replace("{申请日期}", shenQingRQ);
					content=content.replace("{申请部门}",baoFei.getUser().getDep().getDepName());
					content=content.replace("{申请人}", baoFei.getUser().getName());
					content=content.replace("{物资名称}",wuZi.getWuZiMC());
					content=content.replace("{品牌}",wuZi.getPinPai());
					content=content.replace("{规格型号}", wuZi.getGuiGeXH());
					content=content.replace("{报废原因}",baoFei.getBaoFeiYY());
					content=content.replace("{购买日期}", gouMaiRQ);
					content=content.replace("{折旧月限}", "");
					content=content.replace("{报废月限}", "");
					content=content.replaceAll(" ", "&nbsp;");
					content=content.replaceAll("\n", "<br>");
					String access_url="<a href=\""+root+"/youjian/access.do?userId="+user.getId()+"&huanJie="+huanJie+"\">进入</a>";
					content=content.replace("{access_url}", access_url);
					String agree_url="<a href=\""+root+"/youjian/agree.do?id="+baoFei.getId()+"&userId="+user.getId()+"&huanJie="+huanJie+"\">同意</a>";
					content=content.replace("{agree_url}", agree_url);
					String disagree_url="<a href=\""+root+"/youjian/disagree.do?id="+baoFei.getId()+"&userId="+user.getId()+"&huanJie="+huanJie+"\">不同意</a>";
					content=content.replace("{disagree_url}", disagree_url);
				}else if(huanJie==705){
					String format="yyyy-MM-dd";
					SimpleDateFormat sdf=new SimpleDateFormat(format);
					String tiJiaoRQ=sdf.format(baoFeiJL.getCaoZuoRQ());
					String gouMaiRQ="";
					if(wuZi.getGouMaiRQ()!=null)
						gouMaiRQ=sdf.format(wuZi.getGouMaiRQ());
					content=content.replace("{提交日期}", tiJiaoRQ);
					content=content.replace("{使用部门}",baoFei.getUser().getDep().getDepName());
					content=content.replace("{使用人}", baoFei.getUser().getName());
					content=content.replace("{资产编号}", wuZi.getZiChanBH());
					content=content.replace("{物资名称}",wuZi.getWuZiMC());
					content=content.replace("{品牌}",wuZi.getPinPai());
					content=content.replace("{规格型号}", wuZi.getGuiGeXH());
					content=content.replace("{报废原因}",baoFei.getBaoFeiYY());
					content=content.replace("{购买日期}", gouMaiRQ);
					content=content.replace("{折旧月限}", "");
					content=content.replace("{报废月限}", "");
					content=content.replaceAll(" ", "&nbsp;");
					content=content.replaceAll("\n", "<br>");
					String access_url="<a href=\""+root+"/youjian/access.do?userId="+user.getId()+"&huanJie="+huanJie+"\">进入</a>";
					content=content.replace("{access_url}", access_url);
					String agree_url="<a href=\""+root+"/youjian/agree.do?id="+baoFei.getId()+"&userId="+user.getId()+"&huanJie="+huanJie+"\">同意</a>";
					content=content.replace("{agree_url}", agree_url);
					String disagree_url="<a href=\""+root+"/youjian/disagree.do?id="+baoFei.getId()+"&userId="+user.getId()+"&huanJie="+huanJie+"\">不同意</a>";
					content=content.replace("{disagree_url}", disagree_url);
				}else if(huanJie==706){
					String format="yyyy-MM-dd";
					SimpleDateFormat sdf=new SimpleDateFormat(format);
					String tiJiaoRQ=sdf.format(baoFeiJL.getCaoZuoRQ());
					String gouMaiRQ="";
					if(wuZi.getGouMaiRQ()!=null)
						gouMaiRQ=sdf.format(wuZi.getGouMaiRQ());
					content=content.replace("{提交日期}", tiJiaoRQ);
					content=content.replace("{使用部门}",baoFei.getUser().getDep().getDepName());
					content=content.replace("{使用人}", baoFei.getUser().getName());
					content=content.replace("{资产编号}", wuZi.getZiChanBH());
					content=content.replace("{物资名称}",wuZi.getWuZiMC());
					content=content.replace("{品牌}",wuZi.getPinPai());
					content=content.replace("{规格型号}", wuZi.getGuiGeXH());
					content=content.replace("{报废原因}",baoFei.getBaoFeiYY());
					content=content.replace("{购买日期}", gouMaiRQ);
					content=content.replace("{折旧月限}", "");
					content=content.replace("{报废月限}", "");
					content=content.replaceAll(" ", "&nbsp;");
					content=content.replaceAll("\n", "<br>");
					String access_url="<a href=\""+root+"/youjian/access.do?userId="+user.getId()+"&huanJie="+huanJie+"\">进入</a>";
					content=content.replace("{access_url}", access_url);
				}else if(huanJie==707){
					String format="yyyy-MM-dd";
					SimpleDateFormat sdf=new SimpleDateFormat(format);
					String tiJiaoRQ=sdf.format(baoFeiJL.getCaoZuoRQ());
					String gouMaiRQ="";
					if(wuZi.getGouMaiRQ()!=null)
						sdf.format(wuZi.getGouMaiRQ());
					content=content.replace("{提交日期}", tiJiaoRQ);
					content=content.replace("{使用部门}",baoFei.getUser().getDep().getDepName());
					content=content.replace("{使用人}", baoFei.getUser().getName());
					content=content.replace("{资产编号}", wuZi.getZiChanBH());
					content=content.replace("{物资名称}",wuZi.getWuZiMC());
					content=content.replace("{品牌}",wuZi.getPinPai());
					content=content.replace("{规格型号}", wuZi.getGuiGeXH());
					content=content.replace("{报废原因}",baoFei.getBaoFeiYY());
					content=content.replace("{购买日期}", gouMaiRQ);
					content=content.replace("{折旧月限}", "");
					content=content.replace("{报废月限}", "");
					content=content.replaceAll(" ", "&nbsp;");
					content=content.replaceAll("\n", "<br>");
					String access_url="<a href=\""+root+"/youjian/access.do?userId="+user.getId()+"&huanJie="+huanJie+"\">进入</a>";
					content=content.replace("{access_url}", access_url);
					String agree_url="<a href=\""+root+"/youjian/agree.do?id="+baoFeiSPR.getId()+"&userId="+user.getId()+"&huanJie="+huanJie+"\">同意</a>";
					content=content.replace("{agree_url}", agree_url);
					String disagree_url="<a href=\""+root+"/youjian/disagree.do?id="+baoFeiSPR.getId()+"&userId="+user.getId()+"&huanJie="+huanJie+"\">不同意</a>";
					content=content.replace("{disagree_url}", disagree_url);
				}else if(huanJie==708){
					String format="yyyy-MM-dd";
					SimpleDateFormat sdf=new SimpleDateFormat(format);
					String tiJiaoRQ=sdf.format(baoFeiJL.getCaoZuoRQ());
					String gouMaiRQ="";
					if(wuZi.getGouMaiRQ()!=null)
						gouMaiRQ=sdf.format(wuZi.getGouMaiRQ());
					content=content.replace("{提交日期}", tiJiaoRQ);
					content=content.replace("{使用部门}",baoFei.getUser().getDep().getDepName());
					content=content.replace("{使用人}", baoFei.getUser().getName());
					content=content.replace("{资产编号}", wuZi.getZiChanBH());
					content=content.replace("{物资名称}",wuZi.getWuZiMC());
					content=content.replace("{品牌}",wuZi.getPinPai());
					content=content.replace("{规格型号}", wuZi.getGuiGeXH());
					content=content.replace("{报废原因}",baoFei.getBaoFeiYY());
					content=content.replace("{购买日期}", gouMaiRQ);
					content=content.replace("{折旧月限}", "");
					content=content.replace("{报废月限}", "");
					content=content.replaceAll(" ", "&nbsp;");
					content=content.replaceAll("\n", "<br>");
					String access_url="<a href=\""+root+"/youjian/access.do?userId="+user.getId()+"&huanJie="+huanJie+"\">进入</a>";
					content=content.replace("{access_url}", access_url);
				}else if(huanJie==709){
					String format="yyyy-MM-dd";
					SimpleDateFormat sdf=new SimpleDateFormat(format);
					String tiJiaoRQ=sdf.format(baoFeiJL.getCaoZuoRQ());
					String gouMaiRQ="";
					if(wuZi.getGouMaiRQ()!=null)
						gouMaiRQ=sdf.format(wuZi.getGouMaiRQ());
					content=content.replace("{提交日期}", tiJiaoRQ);
					content=content.replace("{使用部门}",baoFei.getUser().getDep().getDepName());
					content=content.replace("{使用人}", baoFei.getUser().getName());
					content=content.replace("{资产编号}", wuZi.getZiChanBH());
					content=content.replace("{物资名称}",wuZi.getWuZiMC());
					content=content.replace("{品牌}",wuZi.getPinPai());
					content=content.replace("{规格型号}", wuZi.getGuiGeXH());
					content=content.replace("{报废原因}",baoFei.getBaoFeiYY());
					content=content.replace("{购买日期}", gouMaiRQ);
					content=content.replace("{折旧月限}", "");
					content=content.replace("{报废月限}", "");
					DecimalFormat df=new DecimalFormat("#.00");
					content=content.replace("{物资原值}", df.format(wuZi.getWuZiYZ()));
					content=content.replace("{物资净值}", df.format(wuZi.getWuZiJingZhi()));
					content=content.replace("{处理方式}", baoFei.getChuLiFS());
					content=content.replace("{回收金额}", df.format(baoFei.getHuiShouJE()));
					content=content.replace("{回收厂家}", baoFei.getHuiShouDW());
					content=content.replaceAll(" ", "&nbsp;");
					content=content.replaceAll("\n", "<br>");
					String access_url="<a href=\""+root+"/youjian/access.do?userId="+user.getId()+"&huanJie="+huanJie+"\">进入</a>";
					content=content.replace("{access_url}", access_url);
					String agree_url="<a href=\""+root+"/youjian/agree.do?id="+baoFei.getId()+"&userId="+user.getId()+"&huanJie="+huanJie+"\">同意</a>";
					content=content.replace("{agree_url}", agree_url);
					String disagree_url="<a href=\""+root+"/youjian/disagree.do?id="+baoFei.getId()+"&userId="+user.getId()+"&huanJie="+huanJie+"\">不同意</a>";
					content=content.replace("{disagree_url}", disagree_url);
				}else if(huanJie==710){
					String format="yyyy-MM-dd";
					SimpleDateFormat sdf=new SimpleDateFormat(format);
					String tiJiaoRQ=sdf.format(baoFeiJL.getCaoZuoRQ());
					String gouMaiRQ="";
					if(wuZi.getGouMaiRQ()!=null)
						gouMaiRQ=sdf.format(wuZi.getGouMaiRQ());
					content=content.replace("{提交日期}", tiJiaoRQ);
					content=content.replace("{使用部门}",baoFei.getUser().getDep().getDepName());
					content=content.replace("{使用人}", baoFei.getUser().getName());
					content=content.replace("{资产编号}", wuZi.getZiChanBH());
					content=content.replace("{物资名称}",wuZi.getWuZiMC());
					content=content.replace("{品牌}",wuZi.getPinPai());
					content=content.replace("{规格型号}", wuZi.getGuiGeXH());
					content=content.replace("{报废原因}",baoFei.getBaoFeiYY());
					content=content.replace("{购买日期}", gouMaiRQ);
					content=content.replace("{折旧月限}", "");
					content=content.replace("{报废月限}", "");
					DecimalFormat df=new DecimalFormat("#.00");
					content=content.replace("{物资原值}", df.format(wuZi.getWuZiYZ()));
					content=content.replace("{物资净值}", df.format(wuZi.getWuZiJingZhi()));
					content=content.replace("{处理方式}", baoFei.getChuLiFS());
					content=content.replace("{回收金额}", df.format(baoFei.getHuiShouJE()));
					content=content.replace("{回收厂家}", baoFei.getHuiShouDW());
					content=content.replaceAll(" ", "&nbsp;");
					content=content.replaceAll("\n", "<br>");
					String access_url="<a href=\""+root+"/youjian/access.do?userId="+user.getId()+"&huanJie="+huanJie+"\">进入</a>";
					content=content.replace("{access_url}", access_url);
					String agree_url="<a href=\""+root+"/youjian/agree.do?id="+baoFei.getId()+"&userId="+user.getId()+"&huanJie="+huanJie+"\">同意</a>";
					content=content.replace("{agree_url}", agree_url);
				}else if(huanJie==711){
					String format="yyyy-MM-dd";
					SimpleDateFormat sdf=new SimpleDateFormat(format);
					String tiJiaoRQ=sdf.format(baoFeiJL.getCaoZuoRQ());
					String gouMaiRQ="";
					if(wuZi.getGouMaiRQ()!=null)
						gouMaiRQ=sdf.format(wuZi.getGouMaiRQ());
					content=content.replace("{提交日期}", tiJiaoRQ);
					content=content.replace("{使用部门}",baoFei.getUser().getDep().getDepName());
					content=content.replace("{使用人}", baoFei.getUser().getName());
					content=content.replace("{资产编号}", wuZi.getZiChanBH());
					content=content.replace("{物资名称}",wuZi.getWuZiMC());
					content=content.replace("{品牌}",wuZi.getPinPai());
					content=content.replace("{规格型号}", wuZi.getGuiGeXH());
					content=content.replace("{报废原因}",baoFei.getBaoFeiYY());
					content=content.replace("{购买日期}", gouMaiRQ);
					content=content.replace("{折旧月限}", "");
					content=content.replace("{报废月限}", "");
					DecimalFormat df=new DecimalFormat("#.00");
					content=content.replace("{物资原值}", df.format(wuZi.getWuZiYZ()));
					content=content.replace("{物资净值}", df.format(wuZi.getWuZiJingZhi()));
					content=content.replace("{处理方式}", baoFei.getChuLiFS());
					content=content.replace("{回收金额}", df.format(baoFei.getHuiShouJE()));
					content=content.replace("{回收厂家}", baoFei.getHuiShouDW());
					content=content.replaceAll(" ", "&nbsp;");
					content=content.replaceAll("\n", "<br>");
					String access_url="<a href=\""+root+"/youjian/access.do?userId="+user.getId()+"&huanJie="+huanJie+"\">进入</a>";
					content=content.replace("{access_url}", access_url);
				}else if(huanJie==712){
					String format="yyyy-MM-dd";
					SimpleDateFormat sdf=new SimpleDateFormat(format);
					String tiJiaoRQ=sdf.format(baoFeiJL.getCaoZuoRQ());
					String gouMaiRQ="";
					if(wuZi.getGouMaiRQ()!=null)
						gouMaiRQ=sdf.format(wuZi.getGouMaiRQ());
					content=content.replace("{提交日期}", tiJiaoRQ);
					content=content.replace("{使用部门}",baoFei.getUser().getDep().getDepName());
					content=content.replace("{使用人}", baoFei.getUser().getName());
					content=content.replace("{资产编号}", wuZi.getZiChanBH());
					content=content.replace("{资产编码}", wuZi.getZiChanBM());
					content=content.replace("{物资名称}",wuZi.getWuZiMC());
					content=content.replace("{品牌}",wuZi.getPinPai());
					content=content.replace("{规格型号}", wuZi.getGuiGeXH());
					content=content.replace("{报废原因}",baoFei.getBaoFeiYY());
					content=content.replace("{购买日期}", gouMaiRQ);
					content=content.replace("{折旧月限}", "");
					content=content.replace("{报废月限}", "");
					DecimalFormat df=new DecimalFormat("#.00");
					content=content.replace("{物资原值}", df.format(wuZi.getWuZiYZ()));
					content=content.replace("{物资净值}", df.format(wuZi.getWuZiJingZhi()));
					content=content.replace("{处理方式}", baoFei.getChuLiFS());
					content=content.replace("{回收金额}", df.format(baoFei.getHuiShouJE()));
					content=content.replace("{回收厂家}", baoFei.getHuiShouDW());
					content=content.replaceAll(" ", "&nbsp;");
					content=content.replaceAll("\n", "<br>");
					String access_url="<a href=\""+root+"/youjian/access.do?userId="+user.getId()+"&huanJie="+huanJie+"\">进入</a>";
					content=content.replace("{access_url}", access_url);
					String agree_url="<a href=\""+root+"/youjian/agree.do?id="+baoFei.getId()+"&userId="+user.getId()+"&huanJie="+huanJie+"\">同意</a>";
					content=content.replace("{agree_url}", agree_url);
					String disagree_url="<a href=\""+root+"/youjian/disagree.do?id="+baoFei.getId()+"&userId="+user.getId()+"&huanJie="+huanJie+"\">不同意</a>";
					content=content.replace("{disagree_url}", disagree_url);
				}
			}else if(huanJie>800 && huanJie<900){
				if(huanJie==802){
					content=content.replace("{资产编号}", wuZi.getZiChanBH());
					content=content.replace("{物资名称}", wuZi.getWuZiMC());
					content=content.replace("{品牌}", wuZi.getPinPai());
					content=content.replace("{规格型号}", wuZi.getGuiGeXH());
					content=content.replace("{使用部门}",wuZi.getDep().getDepName());
					content=content.replace("{使用人}", wuZi.getUser().getName());
					DecimalFormat df=new DecimalFormat("#.00");
					content=content.replace("{物资原值}", df.format(wuZi.getWuZiYZ()));
					content=content.replace("{物资净值}", df.format(wuZi.getWuZiJingZhi()));
					content=content.replace("{累计折旧金额}", df.format(wuZi.getLeiJiZJJE()));
					String gouMaiRQ="";
					String format="yyyy-MM-dd";
					SimpleDateFormat sdf=new SimpleDateFormat(format);
					if(wuZi.getGouMaiRQ()!=null)
						gouMaiRQ=sdf.format(wuZi.getGouMaiRQ());
					content=content.replace("{购买日期}", gouMaiRQ);
					content=content.replace("{折旧月限}", "");
					content=content.replace("{报废月限}", "");
					content=content.replaceAll(" ", "&nbsp;");
					content=content.replaceAll("\n", "<br>");
					String access_url="<a href=\""+root+"/youjian/access.do?userId="+user.getId()+"&huanJie="+huanJie+"\">进入</a>";
					content=content.replace("{access_url}", access_url);
				}else if(huanJie==803){
					content=content.replace("{资产编号}", wuZi.getZiChanBH());
					content=content.replace("{物资名称}", wuZi.getWuZiMC());
					content=content.replace("{品牌}", wuZi.getPinPai());
					content=content.replace("{规格型号}", wuZi.getGuiGeXH());
					content=content.replace("{使用部门}",wuZi.getDep().getDepName());
					content=content.replace("{使用人}", wuZi.getUser().getName());
					DecimalFormat df=new DecimalFormat("#.00");
					content=content.replace("{赔偿金额}", df.format(buPei.getPeiChangJE()));
					content=content.replace("{物资原值}", df.format(wuZi.getWuZiYZ()));
					content=content.replace("{物资净值}", df.format(wuZi.getWuZiJingZhi()));
					content=content.replace("{累计折旧金额}", df.format(wuZi.getLeiJiZJJE()));
					String gouMaiRQ="";
					String format="yyyy-MM-dd";
					SimpleDateFormat sdf=new SimpleDateFormat(format);
					if(wuZi.getGouMaiRQ()!=null)
						gouMaiRQ=sdf.format(wuZi.getGouMaiRQ());
					content=content.replace("{购买日期}", gouMaiRQ);
					content=content.replace("{折旧月限}", "");
					content=content.replace("{报废月限}", "");
					content=content.replaceAll(" ", "&nbsp;");
					content=content.replaceAll("\n", "<br>");
					String access_url="<a href=\""+root+"/youjian/access.do?userId="+user.getId()+"&huanJie="+huanJie+"\">进入</a>";
					content=content.replace("{access_url}", access_url);
				}else if(huanJie==804){
					content=content.replace("{资产编号}", wuZi.getZiChanBH());
					content=content.replace("{物资名称}", wuZi.getWuZiMC());
					content=content.replace("{品牌}", wuZi.getPinPai());
					content=content.replace("{规格型号}", wuZi.getGuiGeXH());
					content=content.replace("{使用部门}",wuZi.getDep().getDepName());
					content=content.replace("{使用人}", wuZi.getUser().getName());
					DecimalFormat df=new DecimalFormat("#.00");
					content=content.replace("{赔偿金额}", df.format(buPei.getPeiChangJE()));
					content=content.replace("{物资原值}", df.format(wuZi.getWuZiYZ()));
					content=content.replace("{物资净值}", df.format(wuZi.getWuZiJingZhi()));
					content=content.replace("{累计折旧金额}", df.format(wuZi.getLeiJiZJJE()));
					String gouMaiRQ="";
					String format="yyyy-MM-dd";
					SimpleDateFormat sdf=new SimpleDateFormat(format);
					if(wuZi.getGouMaiRQ()!=null)
						gouMaiRQ=sdf.format(wuZi.getGouMaiRQ());
					content=content.replace("{购买日期}", gouMaiRQ);
					content=content.replace("{折旧月限}", "");
					content=content.replace("{报废月限}", "");
					content=content.replaceAll(" ", "&nbsp;");
					content=content.replaceAll("\n", "<br>");
					String access_url="<a href=\""+root+"/youjian/access.do?userId="+user.getId()+"&huanJie="+huanJie+"\">进入</a>";
					content=content.replace("{access_url}", access_url);
					String agree_url="<a href=\""+root+"/youjian/agree.do?id="+buPei.getId()+"&userId="+user.getId()+"&huanJie="+huanJie+"\">同意</a>";
					content=content.replace("{agree_url}", agree_url);
				}else if(huanJie==805){
					content=content.replace("{资产编号}", wuZi.getZiChanBH());
					content=content.replace("{物资名称}", wuZi.getWuZiMC());
					content=content.replace("{品牌}", wuZi.getPinPai());
					content=content.replace("{规格型号}", wuZi.getGuiGeXH());
					content=content.replace("{使用部门}",wuZi.getDep().getDepName());
					content=content.replace("{使用人}", wuZi.getUser().getName());
					DecimalFormat df=new DecimalFormat("#.00");
					content=content.replace("{赔偿金额}", df.format(buPei.getPeiChangJE()));
					content=content.replace("{物资原值}", df.format(wuZi.getWuZiYZ()));
					content=content.replace("{物资净值}", df.format(wuZi.getWuZiJingZhi()));
					content=content.replace("{累计折旧金额}", df.format(wuZi.getLeiJiZJJE()));
					String gouMaiRQ="";
					String format="yyyy-MM-dd";
					SimpleDateFormat sdf=new SimpleDateFormat(format);
					if(wuZi.getGouMaiRQ()!=null)
						gouMaiRQ=sdf.format(wuZi.getGouMaiRQ());
					content=content.replace("{购买日期}", gouMaiRQ);
					content=content.replace("{折旧月限}", "");
					content=content.replace("{报废月限}", "");
					content=content.replaceAll(" ", "&nbsp;");
					content=content.replaceAll("\n", "<br>");
					String access_url="<a href=\""+root+"/youjian/access.do?userId="+user.getId()+"&huanJie="+huanJie+"\">进入</a>";
					content=content.replace("{access_url}", access_url);
					String agree_url="<a href=\""+root+"/youjian/agree.do?id="+buPei.getId()+"&userId="+user.getId()+"&huanJie="+huanJie+"\">同意</a>";
					content=content.replace("{agree_url}", agree_url);
				}
			}
			String SSL_FACTORY = "javax.net.ssl.SSLSocketFactory";
			Properties props = System.getProperties();
			props.setProperty("mail.smtp.host", email.getMailServerHost());
			props.setProperty("mail.smtp.socketFactory.class", SSL_FACTORY);
			props.setProperty("mail.smtp.ssl.enable", "true");
			props.setProperty("mail.smtp.socketFactory.fallback", "false");
			props.setProperty("mail.smtp.port", email.getMailServerPort());
			props.setProperty("mail.smtp.socketFactory.port", email.getMailServerPort());
			props.put("mail.smtp.auth", "true");
			Session session = Session.getDefaultInstance(props,
					new Authenticator() {
						protected PasswordAuthentication getPasswordAuthentication() {
							return new PasswordAuthentication(email.getUserName(), email.getPassword());
						}
					});
			try {
				Multipart mainPart = new MimeMultipart();
				BodyPart html = new MimeBodyPart();
				// 设置HTML内容
				html.setContent(content, "text/html; charset=utf-8");
				mainPart.addBodyPart(html);
				Message msg = new MimeMessage(session);
				msg.setFrom(new InternetAddress(email.getUserName()));
				msg.setRecipients(Message.RecipientType.TO,InternetAddress.parse(user.getEmail(), false));
				msg.setSubject(youJian.getTitle());
				msg.setContent(mainPart);
				msg.setSentDate(new Date());
				Transport.send(msg);
			} catch (Exception e) {
				e.printStackTrace();
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}